home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_kdelibs.idb / usr / freeware / kde / include / kconfigdata.h.z / kconfigdata.h
Encoding:
C/C++ Source or Header  |  1999-01-26  |  2.9 KB  |  118 lines

  1. // $Id: kconfigdata.h,v 1.8 1998/04/26 02:24:45 ssk Exp $
  2. //
  3. // $Log: kconfigdata.h,v $
  4. // Revision 1.8  1998/04/26 02:24:45  ssk
  5. // Some classes marked internal.
  6. //
  7. // Revision 1.7  1998/01/18 14:38:53  kulow
  8. // reverted the changes, Jacek commited.
  9. // Only the RCS comments were affected, but to keep them consistent, I
  10. // thought, it's better to revert them.
  11. // I checked twice, that only comments are affected ;)
  12. //
  13. // Revision 1.5  1998/01/15 13:22:29  kalle
  14. // Read-only mode for KSimpleConfig
  15. //
  16. // Revision 1.4  1997/12/12 14:46:04  denis
  17. // Reverting to lower case true/false
  18. //
  19. // Revision 1.3  1997/12/12 14:33:48  denis
  20. // replaced true by TRUE and false by FALSE
  21. //
  22. // Revision 1.2  1997/10/10 19:24:11  kulow
  23. // removed mutable and replace const_cast with a more portable way.
  24. //
  25. // Revision 1.1  1997/10/04 19:51:06  kalle
  26. // new KConfig
  27. //
  28. //
  29. // (C) 1996 by Matthias Kalle Dalheimer
  30.  
  31. #ifndef _KCONFIGDATA_H
  32. #define _KCONFIGDATA_H
  33.  
  34. #include <qdict.h> // QDict
  35. #include <qtstream.h> // QTextStream
  36.  
  37. /**
  38. * Entry-dictionary entry.
  39. * @internal
  40. */
  41. struct KEntryDictEntry
  42. {
  43.   QString aValue;
  44.   bool    bDirty; // must the entry be written back to disk?
  45.   bool    bGlobal; // entry should be written to the global config file
  46.   bool    bNLS;    // entry should be written with locale tag
  47. };
  48.  
  49. typedef QDict<KEntryDictEntry> KEntryDict;
  50. typedef QDict<KEntryDict> KGroupDict;
  51. typedef QDictIterator<KEntryDict> KGroupIterator;
  52. typedef QDictIterator<KEntryDictEntry> KEntryIterator;
  53.  
  54. /**
  55. * Configuration data manager, used internally by KConfig.
  56. * @short Configuration data manager, used internally by KConfig.
  57. * @version $Id: kconfigdata.h,v 1.8 1998/04/26 02:24:45 ssk Exp $
  58. * @author Matthias Kalle Dalheimer (kalle@kde.org)
  59. * @internal
  60. */
  61. class KConfigBaseData
  62. {
  63. friend class KConfig;
  64. friend class KConfigBase;
  65. friend class KSimpleConfig;
  66. private:
  67.   QString aLocalAppFile;
  68.   QString aGlobalAppFile;
  69.   QString aGroup;
  70.   QString aLocaleString; // locale code
  71.   bool bDirty; // is there any entry that has to be written back to disk?
  72.   bool bLocaleInitialized;
  73.   bool bReadOnly; // currently only used by KSimpleConfig
  74.  
  75.   QDict<KEntryDict> aGroupDict;
  76.  
  77. #ifndef NDEBUG
  78.   QString aFile;
  79. #endif
  80.   
  81. public:
  82.   KConfigBaseData();
  83.   KConfigBaseData( const char* pGlobalAppFile, const char* pLocalAppFile );
  84.   
  85.   KGroupIterator* groupIterator( void );
  86. };
  87.  
  88. inline KConfigBaseData::KConfigBaseData() :
  89.     aGroupDict( 37, false )
  90. {
  91.   aGroupDict.setAutoDelete( true );
  92.   aGroup = "<default>";
  93.   bDirty = false;
  94.   bLocaleInitialized = false;
  95.   bReadOnly = false;
  96. }
  97.   
  98. inline KConfigBaseData::KConfigBaseData( const char* pGlobalAppFile,
  99.                                          const char* pLocalAppFile ) :
  100.     aGroupDict( 37, false )
  101. {
  102.   aGroupDict.setAutoDelete( true );
  103.   aLocalAppFile = pLocalAppFile;
  104.   aGlobalAppFile = pGlobalAppFile;
  105.   aGroup = "<default>";
  106.   bDirty = false;
  107.   bLocaleInitialized = false;
  108.   bReadOnly = false;
  109. }
  110.  
  111. inline KGroupIterator* KConfigBaseData::groupIterator(void)
  112. {
  113.   return new KGroupIterator(aGroupDict);
  114. }
  115.  
  116.  
  117. #endif
  118.